load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "create.go",
        "create_cluster.go",
        "create_instancegroup.go",
        "create_keypair.go",
        "create_secret.go",
        "create_secret_ciliumpassword.go",
        "create_secret_dockerconfig.go",
        "create_secret_encryptionconfig.go",
        "create_secret_weavepassword.go",
        "create_sshpublickey.go",
        "delete.go",
        "delete_cluster.go",
        "delete_instance.go",
        "delete_instancegroup.go",
        "delete_secret.go",
        "delete_sshpublickey.go",
        "distrust.go",
        "distrust_keypair.go",
        "edit.go",
        "edit_cluster.go",
        "edit_instancegroup.go",
        "export.go",
        "export_kubeconfig.go",
        "gen_cli_docs.go",
        "get.go",
        "get_addons.go",
        "get_assets.go",
        "get_cluster.go",
        "get_instancegroups.go",
        "get_instances.go",
        "get_keypairs.go",
        "get_secrets.go",
        "get_sshpublickeys.go",
        "main.go",
        "promote.go",
        "promote_keypair.go",
        "replace.go",
        "rolling-update.go",
        "rolling-update_cluster.go",
        "root.go",
        "toolbox.go",
        "toolbox_dump.go",
        "toolbox_instance-selector.go",
        "toolbox_template.go",
        "trust.go",
        "trust_keypair.go",
        "update.go",
        "update_cluster.go",
        "upgrade.go",
        "upgrade_cluster.go",
        "validate.go",
        "validate_cluster.go",
        "version.go",
    ],
    importpath = "k8s.io/kops/cmd/kops",
    visibility = ["//visibility:private"],
    deps = [
        "//:go_default_library",
        "//cmd/kops/util:go_default_library",
        "//pkg/apis/kops:go_default_library",
        "//pkg/apis/kops/registry:go_default_library",
        "//pkg/apis/kops/util:go_default_library",
        "//pkg/apis/kops/validation:go_default_library",
        "//pkg/assets:go_default_library",
        "//pkg/client/simple:go_default_library",
        "//pkg/cloudinstances:go_default_library",
        "//pkg/clouds:go_default_library",
        "//pkg/clusteraddons:go_default_library",
        "//pkg/commands:go_default_library",
        "//pkg/commands/commandutils:go_default_library",
        "//pkg/dump:go_default_library",
        "//pkg/edit:go_default_library",
        "//pkg/featureflag:go_default_library",
        "//pkg/formatter:go_default_library",
        "//pkg/instancegroups:go_default_library",
        "//pkg/kopscodecs:go_default_library",
        "//pkg/kubeconfig:go_default_library",
        "//pkg/pki:go_default_library",
        "//pkg/pretty:go_default_library",
        "//pkg/resources:go_default_library",
        "//pkg/resources/ops:go_default_library",
        "//pkg/sshcredentials:go_default_library",
        "//pkg/try:go_default_library",
        "//pkg/util/templater:go_default_library",
        "//pkg/validation:go_default_library",
        "//pkg/wellknownoperators:go_default_library",
        "//pkg/zones:go_default_library",
        "//upup/pkg/fi:go_default_library",
        "//upup/pkg/fi/cloudup:go_default_library",
        "//upup/pkg/fi/cloudup/awsup:go_default_library",
        "//upup/pkg/fi/utils:go_default_library",
        "//upup/pkg/kutil:go_default_library",
        "//util/pkg/tables:go_default_library",
        "//util/pkg/text:go_default_library",
        "//util/pkg/ui:go_default_library",
        "//util/pkg/vfs:go_default_library",
        "//vendor/github.com/aws/amazon-ec2-instance-selector/v2/pkg/cli:go_default_library",
        "//vendor/github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector:go_default_library",
        "//vendor/github.com/aws/aws-sdk-go/service/ec2:go_default_library",
        "//vendor/github.com/blang/semver/v4:go_default_library",
        "//vendor/github.com/google/go-containerregistry/pkg/name:go_default_library",
        "//vendor/github.com/google/go-containerregistry/pkg/v1/remote:go_default_library",
        "//vendor/github.com/spf13/cobra:go_default_library",
        "//vendor/github.com/spf13/cobra/doc:go_default_library",
        "//vendor/github.com/spf13/pflag:go_default_library",
        "//vendor/github.com/spf13/viper:go_default_library",
        "//vendor/golang.org/x/crypto/ssh:go_default_library",
        "//vendor/helm.sh/helm/v3/pkg/cli/values:go_default_library",
        "//vendor/helm.sh/helm/v3/pkg/strvals:go_default_library",
        "//vendor/k8s.io/api/core/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
        "//vendor/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
        "//vendor/k8s.io/client-go/kubernetes:go_default_library",
        "//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
        "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
        "//vendor/k8s.io/client-go/util/homedir:go_default_library",
        "//vendor/k8s.io/klog/v2:go_default_library",
        "//vendor/k8s.io/kubectl/pkg/cmd/util/editor:go_default_library",
        "//vendor/k8s.io/kubectl/pkg/util/i18n:go_default_library",
        "//vendor/k8s.io/kubectl/pkg/util/templates:go_default_library",
        "//vendor/sigs.k8s.io/yaml:go_default_library",
    ],
)

go_binary(
    name = "kops",
    out = select({
        "@io_bazel_rules_go//go/platform:darwin_amd64": "darwin-amd64/kops",
        "@io_bazel_rules_go//go/platform:darwin_arm64": "darwin-arm64/kops",
        "@io_bazel_rules_go//go/platform:linux_amd64": "linux-amd64/kops",
        "@io_bazel_rules_go//go/platform:linux_arm64": "linux-arm64/kops",
        "@io_bazel_rules_go//go/platform:windows_amd64": "windows-amd64/kops",
    }),
    embed = [":go_default_library"],
    visibility = ["//visibility:public"],
    x_defs = {
        "k8s.io/kops.Version": "{STABLE_KOPS_VERSION}",  # keep
        "k8s.io/kops.GitVersion": "{BUILD_SCM_REVISION}",  # keep
    },
)

go_test(
    name = "go_default_test",
    size = "small",
    srcs = [
        "create_cluster_integration_test.go",
        "create_cluster_test.go",
        "delete_confirm_test.go",
        "integration_test.go",
        "lifecycle_integration_test.go",
        "toolbox_instance-selector_test.go",
        "toolbox_template_test.go",
    ],
    data = [
        "test/values.yaml",
        "//channels:channeldata",  # keep
        "//tests/integration/create_cluster:exported_testdata",  # keep
        "//tests/integration/update_cluster:exported_testdata",  # keep
    ],
    embed = [":go_default_library"],
    shard_count = 10,
    deps = [
        "//cloudmock/aws/mockec2:go_default_library",
        "//cloudmock/gce:go_default_library",
        "//cmd/kops/util:go_default_library",
        "//pkg/apis/kops:go_default_library",
        "//pkg/apis/kops/model:go_default_library",
        "//pkg/commands:go_default_library",
        "//pkg/diff:go_default_library",
        "//pkg/featureflag:go_default_library",
        "//pkg/jsonutils:go_default_library",
        "//pkg/kopscodecs:go_default_library",
        "//pkg/pki:go_default_library",
        "//pkg/testutils:go_default_library",
        "//pkg/testutils/golden:go_default_library",
        "//upup/pkg/fi:go_default_library",
        "//upup/pkg/fi/cloudup:go_default_library",
        "//upup/pkg/fi/cloudup/awsup:go_default_library",
        "//upup/pkg/fi/cloudup/gce:go_default_library",
        "//upup/pkg/fi/cloudup/openstack:go_default_library",
        "//util/pkg/ui:go_default_library",
        "//vendor/github.com/aws/amazon-ec2-instance-selector/v2/pkg/cli:go_default_library",
        "//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
        "//vendor/github.com/aws/aws-sdk-go/service/ec2:go_default_library",
        "//vendor/golang.org/x/crypto/ssh:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
        "//vendor/sigs.k8s.io/yaml:go_default_library",
    ],
)
